package ii.zjf.week4.count;

public class Add5 extends BaseAdd {

    public static boolean addFinish = false;

    public static final Object lock = new Object();

    public static void main(String[] args) throws InterruptedException {

        Thread thread = new Thread(() -> {

            synchronized (lock) {
                count.add();
                addFinish = true;
                lock.notifyAll();
            }

        });

        thread.start();

        synchronized (lock) {
            while (!addFinish) {
                lock.wait();
            }
        }

        System.out.println("success : " + count.getCount());

    }
}
